package com.jingsong.studentapp.fragment;
/*
 * @author zei , QQ:77132995, email:kazeik@163.com
 * 2021-12-18 18:31
 * 类说明:
 */

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.jingsong.studentapp.R;
import com.jingsong.studentapp.page.ExamActivity;

public class LessionItemFragment extends Fragment implements View.OnClickListener {
    private View rootView;

    public static LessionItemFragment newInstance(int position) {
        Bundle bundle = new Bundle();
        bundle.putInt("position", position);
        LessionItemFragment fragment = new LessionItemFragment();
        fragment.setArguments(bundle);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        rootView = inflater.inflate(R.layout.fragment_view, container, false);
        initView(rootView);
        return rootView;
    }

    private void initView(View rootView) {
        int tabIndex = getArguments().getInt("position");
        TextView tvLession = rootView.findViewById(R.id.tvLession);
        tvLession.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.tvLession) {
            startActivity(new Intent(getContext(), ExamActivity.class));
        }
    }
}
